package com.hgyc.mom.tool.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hgyc.mom.common.exception.BizException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.hgyc.mom.tool.mapper.CustomReportFieldMapper;
import com.hgyc.mom.tool.entity.CustomReportField;
import com.hgyc.mom.tool.service.CustomReportFieldService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import lombok.extern.slf4j.Slf4j;

/**
 * 自定义单字段Service业务层实现
 *
 * @author fwj
 * @since 2025-04-29
 */
@Slf4j
@Service
public class CustomReportFieldServiceImpl extends ServiceImpl<CustomReportFieldMapper, CustomReportField> implements CustomReportFieldService {

    @Override
    public void deleteByReportId(Long reportId) {
        LambdaQueryWrapper<CustomReportField> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomReportField::getReportId, reportId);
        this.remove(wrapper);
    }

    @Override
    public List<CustomReportField> getByReportId(Long reportId) {
        LambdaQueryWrapper<CustomReportField> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomReportField::getReportId, reportId);
        return list(wrapper);
    }
}